﻿@model IMall.Web.Models.ViewModels.Manager.OrderDetail

@{
    ViewBag.Title = "Detail";
    Layout = "~/Views/Shared/_ManagerLayout.cshtml";
}
<div class="alert @Model.StateCss" role="alert">
    当前订单状态： <strong>@Model.StateText</strong>
    @if (Model.State == 2)
    {
        <button class="btn btn-success" onclick="deliver('@Model.Id')">发货</button>
    }
</div>
<div class="row clearfix" style="margin-top:20px;">
    <div class="col-md-12 column">
        <div class="tabbable" id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#panel" data-toggle="tab">订单信息</a>
                </li>
            </ul>
            <div class="tab-content" style="border:1px solid #EFEFEF">
                <div class="tab-pane active" id="panel" style="padding:10px;">
                    <div><strong>收货地址：</strong> @Model.Adress</div>
                    <div><strong>运送方式：</strong> 爱商城派送</div>
                    <hr />
                    <div><strong>卖家信息：</strong> 爱商城自营</div>
                    <hr />
                    <div class="row">
                        <div class="col-sm-6">
                            <strong>订单号：</strong> @Model.Id
                        </div>
                        <div class="col-sm-6">
                            <strong>创建时间：</strong> @Model.CreatedTime
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <strong>付款时间：</strong> @Model.PaymentTime
                        </div>
                        <div class="col-sm-6">
                            <strong>成交时间：</strong> @Model.CompleteTime
                        </div>
                    </div>
                    <table class="table table-bordered" style="margin-top:20px;">
                        <tr>
                            <th>商品名称</th>
                            <th>尺寸</th>
                            <th>单价</th>
                            <th>数量</th>
                            <th>优惠</th>
                            <th>运费</th>
                        </tr>
                        <tr>
                            <td>@Model.CommandityName</td>
                            <td>@Model.Size</td>
                            <td>@Model.CommandityPrice 元</td>
                            <td>1 件</td>
                            <td></td>
                            <td>卖家承担运费</td>
                        </tr>
                    </table>
                    <strong>实际成交价：</strong> @Model.Price 元
                    @if (Model.State == 2)
                    {
                        <hr />
                        <button class="btn btn-success" onclick="deliver('@Model.Id')">发货</button>
                    }
                </div>
            </div>
        </div>
    </div>
</div>

@section script{
<script>
    function deliver(id) {
        if (confirm("确认发货吗？")) {
            $.ajax({
                type: "POST",
                url: "/Manager/Deliver",
                data: { id: id },
                dataType: "json",
                success: function (data) {
                    location.href = '/Manager/Detail?id=@Model.Id';
                }
            });
        }
    }
</script>
}

